package com.five.calendar.database.bean;

import android.content.ContentValues;
import android.database.Cursor;

import com.five.calendar.common.database.IDatabaseObject;
import com.five.calendar.database.table.TargetDayTable;

/**
 * Created by zhuxiaoxinsx on 17-9-5.
 */

public class TargetDayBean implements IDatabaseObject {
    //数据id
    public long id;
    //数据对应的父表目标id
    public long targetId;
    //数据时间
    public String time;
    public TargetDayBean(){}
    public TargetDayBean(long targetId, String time){
        this.targetId = targetId;
        this.time = time;
    }
    @Override
    public void writeObject(ContentValues values, String table) {
        if (TargetDayTable.TABLE_NAME.equals(table)) {
            values.put(TargetDayTable.TARGET_ID, targetId);
            values.put(TargetDayTable.TIME, time);
        }
    }

    @Override
    public void readObject(Cursor cursor, String table) {
        if (TargetDayTable.TABLE_NAME.equals(table)) {
            this.targetId = cursor.getLong(cursor.getColumnIndex(TargetDayTable.TARGET_ID));
            this.time = cursor.getString(cursor.getColumnIndex(TargetDayTable.TIME));
            this.id = cursor.getLong(cursor.getColumnIndex(TargetDayTable.ID));
        }
    }
}
